package cn.com.idmy.id.segment.bus;

import com.google.common.eventbus.AsyncEventBus;
import com.google.common.eventbus.EventBus;

import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class FillSegmentUpdater {
    private final EventBus eventBus = new AsyncEventBus("Segment-Updater-Event-Bus", new ThreadPoolExecutor(5, 10, 60, TimeUnit.SECONDS,
            new LinkedBlockingQueue<>(100),
            new ThreadPoolExecutor.CallerRunsPolicy()));

    public FillSegmentUpdater() {
        eventBus.register(new FillSegmentListener());
    }

    public void notifyFill(FillSegmentEvent event) {
        eventBus.post(event);
    }
}
